package com.wicket.okrcomponent.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrcomponent.biz.service.OffStateService;
import com.wicket.okrcomponent.biz.service.dto.req.*;
import com.wicket.okrcomponent.biz.service.dto.res.*;
import com.wicket.okrcomponent.common.ro.OkrResult;
import com.wicket.okrcomponent.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/comp/offState/")
public class OffStateController {

    @Autowired
    OffStateService offStateService;

    /**
   * D2-9查步骤详情(公共)(边界)
   */
    @PostMapping("queryStepDetailComBorder")
    public OkrResult<QueryStepDetailComBorderRespDto> queryStepDetailComBorder(@RequestBody @Validated QueryStepDetailComBorderReqDto reqDTO){
    return OkrResult.success(offStateService.queryStepDetailComBorder(reqDTO));
    }

    /**
   * D2-9查询步骤详情
   */
    @PostMapping("queryStepDetail")
    public OkrResult<QueryStepDetailRespDto> queryStepDetail(@RequestBody @Validated QueryStepDetailReqDto reqDTO){
    return OkrResult.success(offStateService.queryStepDetail(reqDTO));
    }

    /**
   * D2-9查步骤列表(公共)
   */
    @PostMapping("queryStepListCom")
    public OkrResult<QueryStepListComRespDto> queryStepListCom(@RequestBody @Validated QueryStepListComReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryStepListComRespDto retData = offStateService.queryStepListCom(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D2-9新增步骤
   */
    @PostMapping("addStep")
    public OkrResult<AddStepRespDto> addStep(@RequestBody @Validated AddStepReqDto reqDTO){
    return OkrResult.success(offStateService.addStep(reqDTO));
    }

    /**
   * D2-9修改步骤
   */
    @PostMapping("updateStep")
    public OkrResult<UpdateStepRespDto> updateStep(@RequestBody @Validated UpdateStepReqDto reqDTO){
    return OkrResult.success(offStateService.updateStep(reqDTO));
    }
/**
   * D2-9查询高中基层步骤转数据集列表(公共)
   */
    @PostMapping("queryTopMidBasicStepShiftDataSetListCom")
    public OkrResult<QueryTopMidBasicStepShiftDataSetListComRespDto> queryTopMidBasicStepShiftDataSetListCom(@RequestBody @Validated QueryTopMidBasicStepShiftDataSetListComReqDto reqDTO){
    return OkrResult.success(offStateService.queryTopMidBasicStepShiftDataSetListCom(reqDTO));
    }
/**
   * D2-9查询评价主题步骤列表
   */
    @PostMapping("queryEvaThemeStepList")
    public OkrResult<QueryEvaThemeStepListRespDto> queryEvaThemeStepList(@RequestBody @Validated QueryEvaThemeStepListReqDto reqDTO){
    return OkrResult.success(offStateService.queryEvaThemeStepList(reqDTO));
    }
}
